package com.asjy.util;

import com.asjy.po.CategoryExt;
import com.asjy.service.CategoryService;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.servlet.ServletContext;
import java.util.List;

/**
 * @Auther: lilinlin
 * @Date: 2021/4/12
 * @Description: com.asjy.util
 * @version: 1.0
 */
@Component
public class NavUtil {
    @Resource
    private CategoryService categoryService;
    @Resource
    private ServletContext application;

    //初始化导航 等同于init方法
    @PostConstruct
    public void init(){
        System.out.println(".....................++++++");
        List<CategoryExt> indexNav = categoryService.getIndexNav();
        application.setAttribute("indexNav",indexNav);
    }
}